package com.simple.demo.desginModel.observer;

/**
 * 用户进入
 */
public class UserEnter implements Observer,Display{
    private String userName;

    private String time;

    private String msg;
    private String cuuentName;
    private  Subject subject;
    public UserEnter(Subject subject,String cuuentName){
        this.subject = subject;
        this.cuuentName = cuuentName;
        subject.addObserver(this);
    }

    @Override
    public void print() {
     System.out.println("当前用户为"+cuuentName+"，进入为用户:"+userName +" 在 时间 "+time +" 进入系统，消息："+msg);
    }

    @Override
    public void update(String userName, String time, String msg) {
        this.userName=userName;
        this.time = time;
        this.msg= msg;
        print();
    }
}
